package edu.umd.fosite.tests.geom;

import static org.junit.Assert.*;

import edu.umd.fosite.geom.Vec;

import org.junit.Test;

public class VecTest {

	private void assertVecEquals(Vec a, Vec b, double delta) {
		assertEquals(a.X, b.X, delta);
		assertEquals(a.Y, b.Y, delta);
		assertEquals(a.Z, b.Z, delta);
	}

	@Test
	public void magnitude() {
		assertEquals(1, new Vec(1, 0, 0).magnitude(), 0.001);
		assertEquals(1, new Vec(0, 1, 0).magnitude(), 0.001);
		assertEquals(1, new Vec(0, 0, 1).magnitude(), 0.001);
	}

	@Test
	public void sum() {
		assertVecEquals(new Vec(1, 2, 3),
				new Vec(1, 0, 4).add(new Vec(0, 2, -1)), 0.001);
	}

	@Test
	public void normalize() {

	}

	@Test
	public void crossProduct() {
		assertVecEquals(new Vec(-1, 0, 0),
				new Vec(0, 0, 1).cross(new Vec(0, 1, 0)), 0.001);
	}

}
